package com.mini.client;

import com.alibaba.fastjson.JSONObject;
import com.mini.vo.BusinessResult;
import com.mini.vo.DeptVO;
import com.mini.vo.UserVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Set;


/**
 * @author zl
 * @version 1.0
 * @date Created in 2020/2/6
 */
@FeignClient(name = "mini-admin")
public interface MnsClient {

    /**
     * 组织结构拼接的字符串
     * @param deptId
     * @return
     */
    @GetMapping(value = "/api/dept/fullName")
    BusinessResult<String> getDeptFullName(@RequestHeader("sig")String sig, @RequestParam(value = "deptId") Long deptId);

    @GetMapping(value = "/api/dept/level")
    BusinessResult<List<DeptVO>> getDeptsByLevel(@NotNull @RequestParam(value = "level") Integer level);

    @GetMapping(value = "/api/users/simpleInfo")
    BusinessResult<UserVO> getUserSimpleInfo(@RequestHeader("sig")String sig, @RequestParam(value = "userId") Long userId);

    /**
     * 批量查询用户简版信息
     *
     * @param sig
     * @param userIds
     * @return
     */
    @PostMapping(value = "/api/users/batch/simpleInfo")
    BusinessResult<List<UserVO>> batchFindUserList(@RequestHeader("sig")String sig, @RequestBody Set<Long> userIds);

    /**
     * 向下及横向管理运营专员及组长
     * @param userId
     * @return
     */
    @GetMapping(value = "/api/users/scopedOperationUserIds")
    BusinessResult<Set<Long>> scopedOperationUserIds(@RequestHeader("sig")String sig, @RequestParam(value = "userId") Long userId);

    /**
     * 向下及横向管理项目专员
     * @param userId
     * @return
     */
    @GetMapping(value = "/api/users/scopedAdvertisingUserIds")
    BusinessResult<Set<Long>> scopedAdvertisingUserIds(@RequestHeader("sig")String sig,@RequestParam(value = "userId") Long userId);

    /**
     * 所选组织结构包含的所有运营组
     * @param deptIds
     * @return
     */
    @PostMapping(value = "/api/dept/linear/operation/filter")
    BusinessResult<Set<DeptVO>> findOperatDepts(@RequestHeader("sig")String sig,
                                                @RequestBody Set<Long> deptIds, @RequestParam(value = "userId") Long userId);

    @GetMapping(value = "/auth/checkLogin")
    BusinessResult<UserVO> checkLogin(@RequestHeader(value = "Authorization") String Authorization);

    @PostMapping(value = "/api/users/deptOperations")
    BusinessResult<List<UserVO>> getUsersByDept(@RequestHeader(value = "Authorization") String Authorization,
                                                @RequestBody Set<Long> deptIds);

    @GetMapping(value = "/api/dept/byDeptId")
    BusinessResult<DeptVO> getDept(@RequestHeader("sig")String sig,@RequestParam(value = "deptId") Long deptId);

    @GetMapping(value = "/api/users/dept")
    BusinessResult<DeptVO> getUserDept(@RequestHeader("sig")String sig,@RequestParam(value = "userId") Long userId);

    @GetMapping(value = "api/users/deptAdvertisingUserIds")
    BusinessResult<List<JSONObject>> deptAdvertisingUserIds(@RequestHeader("sig")String sig, @RequestParam(value = "deptIds") List<Long> deptIds);

}
